package com.anne.fish.webapp.formbean;

public class Pageine {
	private int pageRowPerPage= 20;
	private long pageTotalRow;
	//private int pageTotalPage;
	private int pageCurrentPage=1;
	//private long pageStart;
	
	
	

	public long getPageStart() {
		return (pageCurrentPage-1)*pageRowPerPage;
	}




	public long getPageTotalRow() {
		return pageTotalRow;
	}




	public void setPageTotalRow(long pageTotalRow) {
		this.pageTotalRow = pageTotalRow;
	}




	/**
	 * 当前页号
	 * @return
	 */
	public int getPageCurrentPage() {
		return pageCurrentPage;
	}




	public void setPageCurrentPage(int pageCurrentPage) {
		if(pageCurrentPage<1){
			return;
		}
		this.pageCurrentPage = pageCurrentPage;
	}

	public boolean incrCurrentPage() {
		pageCurrentPage++;
		return pageCurrentPage >= 1 && pageCurrentPage <= getPageTotalPage();
	}


	public int getPageTotalPage() {
		int fix = 1;
		if (pageTotalRow%pageRowPerPage==0)
			fix =0;
		return (int)(pageTotalRow/pageRowPerPage)+fix;
	}




	/**
	 * 每页的数量
	 * @return
	 */
	public int getPageRowPerPage() {
		return pageRowPerPage;
	}




	public void setPageRowPerPage(int pageRowPerPage) {
		this.pageRowPerPage = pageRowPerPage;
	}

}
